package com.example.yqzs.service;

import com.example.yqzs.dao.UserMapper;

import com.example.yqzs.pojo.User;
import com.example.yqzs.pojo.UserExample;
import org.springframework.beans.factory.annotation.Autowired;

import org.springframework.stereotype.Service;
import tk.mybatis.mapper.entity.Example;

import java.util.List;


@Service
public class UserService {

    @Autowired
    private UserMapper userMapper;

    public void setInsert(User user){
        userMapper.insert(user);
    }

    public int getCount(UserExample example){
        return userMapper.countByExample(example);
    }

    public User getByUser(String name){
        return userMapper.selectUser(name);
    }

    public int setUpdateByUser(User user, UserExample example){
        return userMapper.updateByExampleSelective(user, example);
    }

    public User getUserInformation(String id){
        return userMapper.selectByPrimaryKey(id);
    }

    public List<User> getUser(UserExample example){
        return userMapper.selectByExample(example);
    }

    public int deleteByPrimaryKey(String id){
        return userMapper.deleteByPrimaryKey(id);
    }

}
